﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace StreamingTransmit
{
    class Hikmrserver
    {
        /// <summary>
        /// 初始化，该函数需要在窗口程序初始化时调用
        /// </summary>
        /// <returns>成功返回0，失败返回-1</returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_InitStreamServerLib();

        /// <summary>
        /// 反初始化，该函数需要在窗口程序关闭时调用
        /// </summary>
        /// <returns>成功返回0，失败返回-1</returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_FiniStreamSerLib();

        /// <summary>
        /// 初始化服务端，
        /// </summary>
        /// <param name="port">port是指服务器的侦听端口号，默认值是556</param>
        /// <returns>成功返回0，失败返回-1</returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_StartServer(short port);

        /// <summary>
        /// 未使用
        /// </summary>
        /// <returns></returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_RunServer();

        /// <summary>
        /// 未使用
        /// </summary>
        /// <returns></returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_RunServerLoop();

        /// <summary>
        /// 停止服务端，释放资源
        /// </summary>
        /// <returns>成功返回0，失败返回-1</returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_StopServer();

        /// <summary>
        /// 未使用
        /// </summary>
        /// <returns></returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_GetServerState();

        /// <summary>
        /// 获取当前连接的客户端数目
        /// </summary>
        /// <returns>返回当前连接的客户端数目</returns>
        [DllImport(@"\HK\mrserver.dll")]
        public static extern int MR_GetCurConnection();

    }
}
